package cn.bs.busuo.account.controller;

import cn.bs.busuo.account.pojo.param.Type;
import cn.bs.busuo.account.pojo.param.TypeState;
import cn.bs.busuo.account.pojo.param.addType;
import cn.bs.busuo.account.service.ISightTypeService;
import cn.bs.busuo.common.web.JsonResult;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "3.新增门票")
@RequestMapping("/type")
public class SightTypeController {
    @Autowired
    private ISightTypeService sightTypeService;

    @ApiOperationSupport(order = 100)
    @ApiOperation("增加指定类型门票数")
    @PostMapping("/addtype")
    public JsonResult addType(Type type) {
        sightTypeService.addType(type);
        return JsonResult.ok();
    }

    @ApiOperationSupport(order = 200)
    @ApiOperation("减少指定类型门票数")
    @PostMapping("/redtype")
    public JsonResult redType(Type type) {
        sightTypeService.redType(type);
        return JsonResult.ok();
    }

    @ApiOperationSupport(order = 300)
    @ApiOperation("新增门票类型")
    @PostMapping("/insert")
    public JsonResult insert(addType addType) {
        sightTypeService.insertType(addType);
        return JsonResult.ok();
    }

    @ApiOperationSupport(order = 400)
    @ApiOperation("删除门票类型")
    @PostMapping("/delect")
    public JsonResult delect(Long id) {
        sightTypeService.delectType(id);
        return JsonResult.ok();
    }

    @ApiOperationSupport(order = 500)
    @ApiOperation("改审核状态")
    @PostMapping("/updatestate")
    public JsonResult updatestate(TypeState typeState) {
        sightTypeService.updateState(typeState);
        return JsonResult.ok();
    }
}
